<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加角色信息</title>
    <link rel="stylesheet" href="../../layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="" style="margin:20px">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名</label>
        <div class="layui-input-block">
            <input type="text" name="roleName" lay-verify="required|roleName" autocomplete="off" placeholder="请输入角色名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">角色说明</label>
        <div class="layui-input-block">
            <textarea name="remark" placeholder="请输入内容" lay-verify="remark" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item" pane="">
        <label class="layui-form-label">权限分配</label>
        <div class="layui-input-block">
            <input type="checkbox" name="like1[homepage]" lay-skin="primary" title="后台首页" checked="">
            <input type="checkbox" name="like1[user]" lay-skin="primary" title="我的面板" checked="">
            <input type="checkbox" name="like1[student]" lay-skin="primary" title="学生管理">
            <input type="checkbox" name="like1[course]" lay-skin="primary" title="课程管理">
            <input type="checkbox" name="like1[teacher]" lay-skin="primary" title="教师管理">
            <input type="checkbox" name="like1[administrator]" lay-skin="primary" title="管理员管理">
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="LAY-role-front-submit" id="LAY-role-front-submit">提交</button>
        </div>
    </div>
</form>

<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        base: '../../layui/layuiAdmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['form','layedit','layer','laydate'],function (){
        var $ = layui.$,
            layer = layui.layer,
            form = layui.form,
            laydate = layui.laydate,
            layedit = layui.layedit

        //常规用法
        laydate.render({
            elem: '#entry_date'
        });

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');

        //自定义验证规则
        form.verify({
            roleName: function(value){
                if(value.length < 3){
                    return '角色名至少得3个字符';
                }
            }
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });

        /*//监听提交
        form.on('submit(btn_submit)', function(data){
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });*/


    })
</script>
</body>
</html>